<?php
declare (strict_types = 1);
namespace app\api\controller;
use app\api\BaseController;
// use app\api\middleware\Auth;
use Firebase\JWT\JWT;
use Firebase\JWT\Key;
use think\facade\Db;
use think\facade\Request;

class Banner extends BaseController
{
	protected $middleware = [
    	
    ];
	// 首页轮播展示
	public function index(){
		// 查找首页轮播
		$banner=Db::name('banner')
		->where(['type'=>'banner'])
		->order('sort asc,create_time desc')
		->select()
		->toArray();
		foreach ($banner as $k =>$v){
			// 图片增加域名地址
			$banner[$k]['image']=imgurl($v['image']);
		}
		if($banner){
			return json(['code'=>200,'msg'=>'请求成功','data'=>$banner]);
		}else{
			return json(['code'=>404,'msg'=>'数据不存在']);
		}
		
	}

}
